﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Client_Revenue
{
    public partial class ClientContract : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadData();
            }
        }


        public void LoadData()
        {
            using (var DE = new dominiumEntities())
            {

                var theContracts = (from c in DE.Clients
                                    join co in DE.Contracts on c.ClientId equals co.ClientId
                                    join ce in DE.ContractEstimates on co.ContractId equals ce.ContractId
                                    select new
                                    {
                                        c.ClientId,
                                        c.ClientName,
                                        ce.HeadCount,
                                        ce.EstimatedRevenue,
                                        co.StartDate,
                                        co.ContractNotes
                                    }).ToList();

                gvAllClientContracts.DataSource = theContracts;
                gvAllClientContracts.DataBind();

            }
        }

       
    }
}